#include "stdafx.h"
#include "shader_loader.h"
#include "pageInfoGetter.hpp"
#include "string_converters.h"
#include "shader.h"
#include "st_blinn_env.h"
#include "st_full_motion_blur.h"
#include "st_wheel.h"
int shader_loader::load_shaders()
{
	using namespace Utility;
	m_nums = page_info_getter::Instance().get<int>("shader_info", "info", "number") ;
	for(int i = 0 ; i < m_nums ; ++i)
	{
		std::string name ;
		std::string shader_fx_name ;
		int effect_id ;
		int vertex_describe ;
		std::string find_name = std::string("name") +boost::lexical_cast<std::string>(i) ;
		name = page_info_getter::Instance().get<std::string>("shader_info", "info", find_name) ;
		shader_fx_name = page_info_getter::Instance().get<std::string>("shader_info", name, "shader_fx_name") ;
		effect_id = page_info_getter::Instance().get<int>("shader_info", name, "effect_id") ;
		shader* _type = 0;
		switch (effect_id)
		{
		case SHADER_BLINN_ENV:
			_type=new st_blinn_env;
			break;
		case SHADER_FULL_MOTION_BLUR:
			_type=new st_full_motion_blur;
			break;
		case SHADER_WHEEL:
			_type= new st_wheel;
			break;
		}
		_type->set_id((ShaderIDS)effect_id);
		_type->set_file_name(shader_fx_name);
		_type->init();
		m_coll.push_back(_type);	
	}
	return m_nums;
}

shader_loader::shader_loader()
{

}